package com.csw.mybatisSpringboot.mapper;

import com.baomidou.mybatisplus.core.conditions.Wrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.csw.mybatisSpringboot.config.quanXian.SqlLimit;
import com.csw.mybatisSpringboot.dto.UserListDto;
import com.csw.mybatisSpringboot.entity.User;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @author 1
 */
@Mapper
public interface UserMapper extends BaseMapper<User> {
    @SqlLimit(tableName = "user")
    Page<User> selectAllByName(Page page, @Param("dto") UserListDto dto);

    @SqlLimit(tableName = "user")
    List selectList(@Param("ew") Wrapper queryWrapper);

//    @Select("select * from user where id='1' for update")
//    User selectTestForUpdate();

    @Select("select * from user where id='1'")
    User selectTestForUpdate();

    @Select("select * from user where id='1' lock in share mode")
    User selectTest();
}
